package com.xigua.JucOfBeautiful.chapterOne.interrup1_7;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2022/1/2314:30
 */
public class InterupTest1 {

    public static void main(String[] args) throws InterruptedException {
        Thread threadA = new Thread(()->{
            try {
                System.out.println("threadA begin sleep");
                Thread.sleep(20000);
                System.out.println("thread end sleep");
            } catch (InterruptedException e) {
                System.out.println("thread One is interrupted while sleep");
            }
        },"A");

        threadA.start();
        Thread.sleep(3000);
        threadA.interrupt();
        threadA.join();
        System.out.println("main over");
    }

}
